{layout name="formlayout" /}
<div class="layui-tab layui-form layui-tab-brief" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin"
  style="padding:0 20px;">
  <ul class="layui-tab-title">
    <li class="layui-this">用户信息</li>
    <li>角色分配</li>
  </ul>
  <div class="layui-tab-content">
    <div class="layui-tab-item layui-show">
      <div class="layui-form-item">
        <label class="layui-form-label">用户名</label>
        <div class="layui-input-inline">
          <input type="text" name="username" value="{$user.username}" lay-verify="required" placeholder="请输入用户名"
            autocomplete="off" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">昵称</label>
        <div class="layui-input-inline">
          <input type="text" name="nickname" value="{$user.nickname}" lay-verify="required" placeholder="请输入昵称"
            autocomplete="off" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">生日</label>
        <div class="layui-input-inline">
          <input type="text" name="birthday" id="birth" value="{$user.birthday}" lay-verify="required"
            autocomplete="off" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">手机号码</label>
        <div class="layui-input-inline">
          <input type="text" name="phone" value="{$user.phone}" lay-verify="phone" placeholder="请输入号码"
            autocomplete="off" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">邮箱</label>
        <div class="layui-input-inline">
          <input type="text" name="email" value="{$user.email}" lay-verify="email" placeholder="请输入邮箱"
            autocomplete="off" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">头像</label>
        <div class="layui-input-inline">
          <input type="text" name="avatar" value="{$user.avatar}" lay-verify="required" placeholder="请上传图片"
            autocomplete="off" class="layui-input">
        </div>
        <button style="float: left;" type="button" class="layui-btn" id="layuiadmin-upload-useradmin">上传图片</button>
      </div>
      <div class="layui-form-item" lay-filter="sex">
        <label class="layui-form-label">选择性别</label>
        <div class="layui-input-block">
          <input type="radio" name="sex" value="1" title="男" {if ($user.sex==1)} checked="checked" {/if}> <input
            type="radio" name="sex" value="2" title="女" {if ($user.sex==2)} checked="checked" {/if}> </div> </div> <div
            class="layui-form-item layui-hide">
          <input type="hidden" name="id" value="{$user.id}">
          <input type="button" lay-submit lay-filter="zbc-user-submit" id="zbc-user-submit" value="确认">
        </div>
      </div>
      <div class="layui-tab-item">
        <div class="layui-form-item">
          <label for="" class="layui-form-label">角色列表</label>
          <div class="layui-input-block">
            {volist name="rolelist" id="item"}
            <input type="checkbox" lay-skin="primary" name="roleIds[]" value="{$item.id}" {volist name="user.roles"
              id="role" } {if ($item.id==$role.id)} checked="checked" {/if} {/volist} title="{$item.name}">
            {/volist}
          </div>
        </div>
      </div>
    </div>
  </div>
  <script>
    layui.config({
      base: '/static/layuiadmin/' //静态资源所在路径
    }).extend({
      index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'upload', 'laydate'], function () {
      var $ = layui.$
        , form = layui.form
        , laydate = layui.laydate
        , upload = layui.upload;

      laydate.render({
        elem: '#birth'
      })

      upload.render({
        elem: '#layuiadmin-upload-useradmin'
        , url: '/admin/upload'
        , accept: 'images'
        , method: 'get'
        , acceptMime: 'image/*'
        , done: function (res) {
          $(this.item).prev("div").children("input").val(res.data.src)
        }
      });
    })
  </script>